<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<%@ include file="/web/header.jsp" %>
<title>Insert title here</title>
</head>
<body>
<body>
	<fieldset class="layui-elem-field" style='margin:30px;padding:30px'>
		<legend>添加部门信息</legend>
		<div class="layui-field-box">
			<form class="layui-form-pane layui-form">
				<div class="layui-form-item">
					<label class="layui-form-label">部门编号</label>
					<div class="layui-input-inline">
						<input class="layui-input" name="code" type="text" placeholder="请输入编号"
						required lay-verify="required" autocomplete="off">
					</div>
				</div>
				
				<div class="layui-form-item">
					<label class="layui-form-label">部门名称</label>
					<div class="layui-input-inline">
						<input class="layui-input" name="name" type="text" placeholder="请输入名称"
						 required lay-verify="required" autocomplete="off" />
					</div>
				</div>
				
				<div class="layui-form-item">
					<label class="layui-form-label">部门电话</label>
					<div class="layui-input-inline">
						<input class="layui-input" name="tel" type="text" placeholder="请输入电话"
						required lay-verify="required" autocomplete="off">
					</div>
				</div>
				
				<div class="layui-form-item">
					<div class="layui-input-inline">
						<input type="button" value="确定" class="layui-btn" lay-submit lay-filter="add" />
						<input type="reset" value="重置" class="layui-btn layui-btn-primary" />			
					</div>
					<input type="button" value="关闭" class="layui-btn" onclick="toClose()"/>
				</div>
				<input type="hidden" name="action" value="add" />
			</form>
		</div>
	</fieldset>
	<script type="text/javascript">
			
		formOn('submit(add)','/department','text',function(data){
			console.log(data)
			if(1==data){
				layer.msg("添加成功",toClose)
			}else if('E'==data){
				layer.msg("编号重复")
			}else{
				layer.msg("添加失败")
			}
		})
		
	</script>
</body>
</html>